From: Marina Zhurakhinskaya Date: Thu, 30 Sep 2010 21:02:16 +0000 (-0400) Subject: Don't show the summary if a new item got removed before we had a chance to show it X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~9677 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b017a2187bc69e8d775d8f2cb71268742965228b;p=gnome-shell.git Don't show the summary if a new item got removed before we had a chance to show it It's possible that an item that was added to the summary got removed before we had a chance to show the summary because the user has interacted with the notification (e.g. clicked on an application ready notification). We should not be showing the summary with an unchanged set of items in this case. However, it is possible that multiple items were added to the summary before we had a chance to show the summary, and only some of them got removed. In view of this scenario, we can't just use a boolean flag to indicate if the summary needs to be shown, but have to maintain an array of new summary items instead. https://bugzilla.gnome.org/show_bug.cgi?id=630939 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 7bdf2f45f..aa65a1557 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -917,6 +917,11 @@ MessageTray.prototype = { })); this._summaryItems = []; + // We keep a list of new summary items that were added to the summary since the last + // time it was shown to the user. We automatically show the summary to the user if there + // are items in this list once the notifications are done showing or once an item gets + // added to the summary without a notification being shown. + this._newSummaryItems = []; this._longestSummaryItem = null; }, @@ -955,7 +960,6 @@ MessageTray.prototype = { let summaryItem = new SummaryItem(source, minTitleWidth); this._summary.insert_actor(summaryItem.actor, 0); - this._summaryNeedsToBeShown = true; let newItemTitleWidth = summaryItem.getTitleNaturalWidth(); if (newItemTitleWidth > minTitleWidth) { @@ -967,6 +971,7 @@ MessageTray.prototype = { } this._summaryItems.push(summaryItem); + this._newSummaryItems.push(summaryItem); source.connect('notify', Lang.bind(this, this._onNotify)); @@ -1007,6 +1012,10 @@ MessageTray.prototype = { this._summary.remove_actor(this._summaryItems[index].actor); + let newSummaryItemsIndex = this._newSummaryItems.indexOf(this._summaryItems[index]); + if (newSummaryItemsIndex != -1) + this._newSummaryItems.splice(newSummaryItemsIndex, 1); + this._summaryItems.splice(index, 1); if (this._longestSummaryItem.source == source) { @@ -1214,7 +1223,7 @@ MessageTray.prototype = { let notificationsDone = !notificationsVisible && !notificationsPending; if (this._summaryState == State.HIDDEN) { - if (notificationsDone && this._summaryNeedsToBeShown) + if (notificationsDone && this._newSummaryItems.length > 0) this._showSummary(true); else if (summarySummoned) this._showSummary(false); @@ -1438,7 +1447,7 @@ MessageTray.prototype = { }, _showSummaryCompleted: function(withTimeout) { - this._summaryNeedsToBeShown = false; + this._newSummaryItems = []; if (withTimeout) { this._summaryTimeoutId = @@ -1459,7 +1468,7 @@ MessageTray.prototype = { time: ANIMATION_TIME, transition: 'easeOutQuad' }); - this._summaryNeedsToBeShown = false; + this._newSummaryItems = []; }, _showSummaryNotification: function() {